﻿define('scheduleType',
    ['ko', 'formActions'],
 function (ko, formActions) {
     var scheduleType = function(c) {
         var self = this;

         self.color = ko.observable();
         self.id = ko.observable();
         self.title = ko.observable();
         self.selected = ko.observable(false);

         self.load = function(obj) {
             self.title(obj.title);
             self.color(obj.color);
             self.id(obj.id);
             if (obj.selected != null) self.selected(obj.selected);
         };

         if (c != null) self.load(c);
         
         var formAction = new formActions("/api/Classifiers/", self);
         self.validation = function () { formAction.validation(); };
         self.clearValidation = function () { formAction.clearValidation(); };
         self.save = function (parent, dlg) {
             formAction.save(parent, dlg);
         };
     };
     
     return scheduleType;
 });